package com.team11.server.controller.admin;

import com.team11.server.pojo.TInformation;
import com.team11.server.service.admin.Admin_Update_T_Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin
@RestController
@Api(tags = "管理员接口")
public class Admin_UpdateT_Controller {
    @Autowired
    private Admin_Update_T_Service admin_update_t_service;
    @ApiOperation("进入编辑页面根据id获取教师原始数据")
    @PostMapping("/Sel_T_ById")
    public TInformation Sel_T_Byid(Integer tId){
        return admin_update_t_service.SelTById(tId);
    }
    @ApiOperation("编辑教师信息")
    @PostMapping("/update_T")
    public String Update_T(TInformation tInformation){
        String s=admin_update_t_service.Sel_haveTid(tInformation);
        if (s.equals("1")){
            s=admin_update_t_service.Update_t(tInformation);
            return s;
        }
        else{
            return s;
        }
    }
    @ApiOperation("启用/停用教师")
    @PostMapping("/update_T_State")
    public String Update_T_State(TInformation tInformation){
        return admin_update_t_service.Update_T_State(tInformation);
}
}
